package com.principle.srp;

/**
 * @author yangguanzan
 * @date 3/10/22
 * @description
 */
public class UserInfo implements IUserInfo {

    private String password;

    private String username;

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public void setUsername(String username) {
        this.username = username;

    }

    @Override
    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public boolean changePassword(String newPwd,String confirmPwd) {

        boolean fail = null==newPwd||newPwd.isEmpty()||null==confirmPwd
            ||confirmPwd.isEmpty()||!newPwd.equals(confirmPwd);

        if(!fail) {
            this.password = newPwd;
        }
        return !fail;
    }

    @Override
    public String getUsername() {
        return this.username;
    }
}
